import React, { useState } from 'react';
import { Modal, Descriptions } from "antd";
import { useSelector, useDispatch } from "react-redux";
import { setInfoVisible } from '../../store/slice/receiveSlice';

export default function ReceiveModal() {

    const dispatch = useDispatch();
    const { receiveInfo, infoVisible } = useSelector((state => state.receive));

    const handleCancel = () => {
        dispatch(setInfoVisible(false));
    }

    return (
        <Modal
            title="收货信息"
            visible={infoVisible}
            onCancel={handleCancel}
            okText="关闭"
            width="700px"
        >
            <Descriptions title="收货信息" bordered>
                <Descriptions.Item label="收货人">{receiveInfo.receiveName}</Descriptions.Item>
                <Descriptions.Item label="联系电话">{receiveInfo.receivePhone}</Descriptions.Item>
                <Descriptions.Item label="收货地址" labelStyle={{
                    width: "200px"
                }} span={3}>
                    {receiveInfo.receiveAddr}
                </Descriptions.Item>
            </Descriptions>
        </Modal>
    )
}
